# 列表遍历
def list_bianli_for():
    try:
        # 输出列表中的元素
        my_list = [10, 20, 30, 40, 50]
        for i in my_list:
            print(i)
    except Exception as e:
        print('程序执行出错，抛出异常：', e)
    print('程序运行结束-list_bianli_for！')

def list_bianli_while():
    try:
        # 输出列表中的元素
        my_list = [10, 20, 30, 40, 50]
        i = 0
        while i < len(my_list):
            print(my_list[i])
            i+=1
    except Exception as e:
        print('程序执行出错，抛出异常：', e)
    print('程序运行结束-list_bianli_while！')
if __name__ == '__main__':
    # 调用遍历函数
    list_bianli_for()
    list_bianli_while()
